class CreateBlogPosts < ActiveRecord::Migration
  def self.up
    create_table :blog_posts do |t|
      t.string    :title
      t.string    :stub_name
      t.text      :body_markdown
      t.text      :body_html
      t.boolean   :is_published, :default => false
      t.datetime  :published_at
      t.integer   :author_id

      t.timestamps
    end
    
    add_index :blog_posts, :published_at, :unique => false
    add_index :blog_posts, [:stub_name, :published_at], :unique => false
  end

  def self.down
    drop_table :blog_posts
  end
end
